//============================================================================
// Name        : HW1.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <math.h>
#include <string.h>
#include <vector>

using namespace std;

long base2(int num){
	long multi=1;
	long ans=num%2;
	num=num/2;
	while (num >0) {
		multi=multi*10;
		ans=(multi*(num%2))+ans;
		num=num/2;
	}
	return ans;
}

vector<string> split(char sent[]){
	vector<string> ans;
	string str=sent;
	string stam;
	int begin=0;
	int end=str.find_first_of(' ',begin);
	while (end!=string::npos){
		//cout << "found word " << str.substr(begin,end-begin) << " and end value is " <<end << endl;
		ans.push_back(str.substr(begin,end-begin));
		begin=end+1;
		while (str[begin]==' ') {
			begin++;
		}
		end=str.find_first_of(' ',begin);
	}
	ans.push_back(str.substr(begin,str.size()));
	//cout << "found word " << str.substr(begin,end-begin) << " and end value is " <<end << endl;
	return ans;
}

void printWords(vector<string> spl){
	for (size_t i=0;i<spl.size();i++){
			cout << spl[i] << endl;
		}
}

int main() {
	cout << base2(17) << endl;
	printWords(split("THIS  IS    NOT  SPARTA!"));

	return 0;
}

